﻿document.getElementById('textarea').value = chrome.extension.getBackgroundPage().imgurl;

function addrule() {	
	var value = document.getElementById('textarea').value;
	if(localStorage.rules.indexOf(value)==-1){
		if(localStorage.rules != ''){ localStorage.rules += ','; }
		localStorage.rules += document.getElementById('textarea').value;
		//chrome.extension.getBackgroundPage().loadBlock;
		chrome.runtime.sendMessage({method: "loadBlock"}, function(response) {
			window.close();	
		});
	}else{
		document.getElementById('msg').textContent = '规则已存在';
	}
}

document.getElementById('confirm').onclick = addrule;